package com.meilingcloud.common.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 流程类型
 */
public enum StockType {

    IN("in", "入库"),
    OUT("out", "出库"),
    CLAIM("claim", "申领"),
    RETURN("return", "归还"),
    DESTROY("destroy", "销毁"),
    ;

    private final String code;
    private final String info;

    StockType(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public static StockType getTypeByCode(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (StockType type : StockType.values()) {
            if (type.getCode().equals(value)) {
                return type;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

}
